package com.weibo.dip.docker;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.model.Image;
import com.github.dockerjava.core.DockerClientBuilder;

import java.util.List;

/** Created by haisen on 2018/6/21. */
public class DockerImageinfo {

  /** start. */
  public static void main(String[] args) {
    DockerClient dockerClient = DockerClientBuilder.getInstance().build();

    List<Image> images = dockerClient.listImagesCmd().exec();
    for (Image image : images) {
      System.out.print("id=" + image.getId() + "   ");
      System.out.print("created=" + image.getCreated() + "   ");
      System.out.print("virtualsize=" + image.getVirtualSize() + "   ");
      System.out.print("repotags=");
      String[] arr = image.getRepoTags();
      for (String str : arr) {
        System.out.print(str + "  **  ");
      }
      System.out.println();
    }
  }
}
